<?php
class m_rekap_koin_dropzone extends Model{
    function get_list_rekap_koin_dropzone($option){
        $where = "";
        $awal = $option['awal'];
        $akhir = $option['akhir'];
        if($awal != "" && $akhir != ""){
            $where .= "where cd.tanggal between '$awal' and '$akhir'";
        }
        $id_dropzone = $option['idDropzone'];
        if($id_dropzone != ""){
            $where .= " and dc.id_dropzone = '$id_dropzone'";
        }
        $query = $this->db->query("select dc.jumlah,cd.kegiatan,cd.tanggal,cd.lokasi from detail_collecting_day dc
        join collecting_day cd on dc.id_collecting_day = cd.id $where");
        
        if($query->num_rows()>0){
            $data = $query->result_array();
        }else $data = array();
        
        foreach ($data as $row){
            if($row['jumlah'] == ""){
                 $jumlah[] = 0;
             }else $jumlah[] = $row['jumlah'];
        }
        $return['master'] = $data;
        $return['max'] = max($jumlah);
        
        return $return;
    }
}
?>
